import React, { Component } from 'react'
import { Link } from 'react-router-dom'

class Home extends Component {
  render() {
    // console.log(this.props)
    return (
      <div>
        <h3>我是Home页面</h3>
        <hr />
        <button
          onClick={() => {
            this.props.history.replace('/about')
          }}
        >
          去关于
        </button>

        <hr />
        <ul>
          <li>
            <Link to="/detail/1?title=aaa">详情1</Link>
          </li>
          <li>
            {/* 导航传state方法，则一定要用对象的方式 */}
            <Link
              to={{
                pathname: '/detail/2',
                search: 'title=bbb',
                state: { click: 100 }
              }}
            >
              详情2
            </Link>
          </li>
        </ul>
      </div>
    )
  }
}

export default Home
